﻿using System.Web.Mvc;
using Abp.Web.Mvc.Authorization;
using MyCompanyName.AbpZeroTemplate.Authorization;
using MyCompanyName.AbpZeroTemplate.Web.Controllers;
using MyCompanyName.AbpZeroTemplate.Web.Areas.Mpa.Models.Dashboard;
using MyCompanyName.AbpZeroTemplate.Dashboard;
using MyCompanyName.AbpZeroTemplate.Dashboard.Dto;

namespace MyCompanyName.AbpZeroTemplate.Web.Areas.Mpa.Controllers
{
    [AbpMvcAuthorize(AppPermissions.Pages_Tenant_Dashboard)]
    public class DashboardController : AbpZeroTemplateControllerBase
    {
        private readonly IDashboardService _dashbordAppService;
        public DashboardController(IDashboardService dashbordAppService)
        {
            this._dashbordAppService = dashbordAppService;
        }

        public ActionResult Index()
        {
            return View();
        }

        public JsonResult GetData()
        {
            DashbordDto ObjDto= _dashbordAppService.GetDashbord();
            return Json(
                    new
                    {
                        TotalCount = ObjDto.TotalCount,
                        SurplusCount = ObjDto.SurplusCount,
                        AccountCount = ObjDto.AccountCount,
                        CardCount = ObjDto.CardCount
                    });
        }
    }
}